<?php
/**
 ***********************************************************************************************************************
 * 获取申通E3系统基础网点信息
 * @author llq  2015/5/20
 ***********************************************************************************************************************
 */
namespace soa\sto;
use soa\client;

/**
 * Class courier
 * @package soa\sto
 */
class branch extends client
{
    /**
     * 服务地址
     * @var string
     */
    public $service_url = 'http://express.core.kuaidihelp.com/';

    /**
     * 服务名称
     * @var string
     */
    protected $service_name = 'kuaidihelp_express';
    /**
     * @param $name
     * @return array|bool
     */
    public function getBranchByName($name)
    {
        if(empty($name) || strlen($name) > 100) {
            return array();
        }
        return $this->get('v1/parter/sto/getBranchByName', array('branch_name' => $name));
    }

    /**
     * @param $id
     * @return array|bool
     */
    public function getBranchById($id)
    {
        if(empty($id) || !is_numeric($id)) {
            return array();
        }
        return $this->get('v1/parter/sto/getBranchById', array('branch_id' => $id));
    }

    /**
     * @param array $names
     * @return array|bool
     */
    public function getBranchByNames(array $names)
    {
        if(empty($names)) {
            return array();
        }
        return $this->post('v1/parter/sto/getBranchByNames', array('branch_names' => implode(',', $names)));
    }

    /**
     * @param array $ids
     * @return array|bool
     */
    public function getBranchByIds(array $ids)
    {
        if(empty($ids)) {
            return array();
        }
        return $this->post('v1/parter/sto/getBranchByIds', array('branch_ids' => implode(',', $ids)));
    }

}